import { getAllDict } from "@/request/apis/dict.js";

import {
  getTenantId,
  getHospitalInfo,
  getSubscriptionTemplateIds,
} from "@/request/apis/hospital.js";
//sdfijlsdjlfdslj
import { getHospitalConfig } from "@/request/apis/hospital.js";

export default function (callback) {
  const appid = wx.getAccountInfoSync().miniProgram.appId;
  console.log(appid);
  return Promise.all([
    getTenantId(appid),
    // getHospitalInfo(),
    // getAllDict(),
    // getSubscriptionTemplateIds(),
    // getHospitalConfig()
  ])
    .then(async (res) => {
      console.log(res);
      uni.setStorageSync("tenantId", res[0].id);
      // uni.setStorageSync("system-hospital", res[1]);
      // uni.setStorageSync("system-dictionary", res[2]);
      // uni.setStorageSync("system-subscription-templates", res[3]);
      // let systemHospitalconfig = {};
      // for (let i = 0; i < res[4].length; i++) {
      // 	systemHospitalconfig[res[4][i].paramsKey] = res[4][i].paramsValue
      // }
      // uni.setStorageSync("system-hospital-config", systemHospitalconfig);
      if (callback) {
        await callback();
      }
    })
    .catch(() => {});
}
